package top.z.orm.handle.osql.core;

import top.z.orm.core.osql.BeeException;
import top.z.orm.core.osql.BeeSQLException;
import top.z.orm.core.osql.exception.BeeIllegalAccessException;
import top.z.orm.core.osql.exception.BeeInstantiationException;

import java.sql.SQLException;

public class ExceptionHelper {

    public static BeeSQLException convert(SQLException e) {
        return new BeeSQLException(e.getMessage(), e.getSQLState(), e.getErrorCode(), e);
    }

    public static BeeIllegalAccessException convert(IllegalAccessException e) {
        return new BeeIllegalAccessException(e.getMessage(), e);
    }

    public static BeeInstantiationException convert(InstantiationException e) {
        return new BeeInstantiationException(e.getMessage(), e);
    }

    public static BeeException convert(Exception e) {
        return new BeeException(e.getMessage(), e);
    }
}
